package com.webchat.user.service.relation;

import com.webchat.common.enums.AccountRelationTypeEnum;
import org.springframework.stereotype.Service;


@Service
public class User2ServerAccountRelationService extends AbstractAccountRelationService {


    @Override
    protected AccountRelationTypeEnum getRelationType() {

        return AccountRelationTypeEnum.USER_SERVER;
    }

    @Override
    protected boolean isAsyncDoAfterComplete() {

        return false;
    }

    @Override
    protected void doAfterComplete(Long id, String sourceAccount, String targetAccount, boolean subscribe) {
        if (subscribe) {
            super.init(targetAccount, sourceAccount);
            super.addTargetAccountRelationListCache(targetAccount, sourceAccount);
            super.init(sourceAccount, targetAccount);
            super.addTargetAccountRelationListCache(sourceAccount, targetAccount);
            super.addTargetAccount2SourceLastChattingList(sourceAccount, targetAccount);
        }
    }
}
